<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" media="screen" href="../../css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
</head>
<body>
    <div>
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
            <div>
                <header style="height: 100%">
                    <div align="left">
	                    <table style="width: 100%">
	                   		<tr>
	                   			<td>
		                   			<form class="form-inline" onsubmit="return false">
										<div class="form-group">
											id：
											<input id="id" type="text" class="form-control" style="width: 140px" >
											立项时间：
											<input id="approvalTime" type="text" class="form-control" style="width: 140px">
											项目编号：
											<input id="projectNumber" type="text" class="form-control" style="width: 140px">
											<button id="searchBt" class="layui-btn layui-btn-sm"><i class="layui-icon">&#xe615;</i>搜索</button>
										</div>
									</form>
	                   			</td>
	                   			<td align="right">
	                   				<button class="layui-btn layui-btn-sm" onclick="location.href='addProjectFollowInfo.html'">
                                      <i class="layui-icon">&#xe608;</i> 添加
                                    </button>
	                   			</td>
	                   		</tr> 
	                    </table>
					</div>
                </header>
                
                <div>
                    <div class="widget-body no-padding">
						<!--<table id="dt-table"
							   class="table table-striped table-bordered table-hover order-column"
							   style="width: 100%">
						</table>-->
                       <table id="dt-table" class="table table-striped table-bordered table-hover" style="width:100%">
                            <thead>
                                <tr>
                                </tr>                       
                                <tr>
									<th >id</th>
									<th> 更新时间</th>
									<th >立项时间</th>
									<th >项目编号</th>
									<th >项目名称</th>
									<th >项目地点</th>
									<th >项目金额(万)</th>
									<th >集成商名称</th>
									<th >用户名称</th>
									<th >用户场景</th>
									<th >主要产品</th>
									<th >规格</th>
									<th >数量</th>
									<th >招投标方式</th>
									<th >招投标时间</th>
									<th >成功率</th>
									<th >项目进展</th>
									<th >友商</th>
									<th >竞品信息</th>
									<th >预计落地时间</th>
									<th >预计安装时间</th>
									<th >失败及原因</th>
									<th >备注</th>
									<th style="width: 10%">操作</th>
                                </tr>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

<script type="text/javascript" src="../../js/libs/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="../../js/jq.js"></script>
<script type="text/javascript" src="../../js/plugin/datatables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="../../js/plugin/datatables/dataTables.bootstrap.min.js"></script>
<script type="text/javascript" src="../../layui/layui.js"></script>
<script type="text/javascript" src="../../js/my/permission.js"></script>
<script type="text/javascript" src="../../js/dict.js"></script>
<script type="text/javascript" src="../../js/dataUtils.js"></script>
<script type="text/javascript">
var pers = checkPermission();


var mainProducts = showDictSelect("mainProducts", "mainProduct",true);
var projectDebriefing = showDictSelect("projectDebriefing", "prodebriefing",true);
var example;
function init(){
	example =  $('#dt-table').DataTable({
        	"searching": false,
        	"processing": false,
        	"serverSide" : true,
		    "scrollX": true,
			"autoWidth": false,
			"info":true,
        	"language": {
                "url": "/js/plugin/datatables/Chinese.lang"
            },
        	"ajax": {
        		"url" : "/projectFollowInfos/findDataList",
        		"type":"post",
        		"data":function(d){
    				d.id = $("#id").val();
    				d.approvalTime = $('#approvalTime').val();
    				d.projectNumber = $('#projectNumber').val();
    			}
        	},
        	"dom": "<'dt-toolbar'r>t<'dt-toolbar-footer'<'col-sm-10 col-xs-12 hidden-xs'i><'col-xs-12 col-sm-10' p v>>",	
            "columns": [
				{"data" : "id", "defaultContent" : "",
					"orderable":false,"visible" : false},
				{"data" : "modifyDate", "defaultContent" : "",
					"orderable":false},
				{"data" : "approvalTime", "defaultContent" : "",
					"orderable":false},
				{"data" : "projectNumber", "defaultContent" : "",
					"orderable":false},
				{"data" : "entryName", "defaultContent" : "",
					"orderable":false},
				{"data" : "projectLocation", "defaultContent" : "",
					"orderable":false},
				{"data" : "projectAmount", "defaultContent" : "",
					"orderable":false},
				{"data" : "integratorName", "defaultContent" : "",
					"orderable":false},
				{"data" : "userName", "defaultContent" : "",
					"orderable":false},
				{"data" : "userScenarios", "defaultContent" : "",
					"orderable":false},
				{"data" : "mainProducts", "defaultContent" : "",
					"render": function (data, type, row) {
						return mainProducts[data];
					},
					"orderable":false
				},
				{"data" : "specifications", "defaultContent" : "",
					"orderable":false},
				{"data" : "number", "defaultContent" : "",
					"orderable":false},

				{"data" : "biddingMode", "defaultContent" : "",
					"orderable":false},
				{"data" : "biddingTime", "defaultContent" : "",
					"orderable":false},
				{"data" : "successRate", "defaultContent" : "",
					"orderable":false},
				{"data" : "projectDebriefing", "defaultContent" : "",
					"render": function (data, type, row) {
						return projectDebriefing[data];
					},
					"orderable":false
				},
				{"data" : "friendBusiness", "defaultContent" : "",
					"orderable":false},
				{"data" : "competitiveProInfo", "defaultContent" : "",
					"orderable":false},
				{"data" : "estimateLandingTime", "defaultContent" : "",
					"orderable":false},
				{"data" : "estimatedInstallationTime", "defaultContent" : "",
					"orderable":false},
				{"data" : "failureAndReasons", "defaultContent" : "",
					"orderable":false},
				{"data" : "remark", "defaultContent" : "",
					"orderable":false},
				{
								"data": "", 
								"defaultContent": "",
								"orderable":false,
						        "render": function (data, type, row) {
                		           var id = row['id'];
                		           var href = "updateProjectFollowInfo.html?id=" + id;
                                   var edit = buttonEdit(href, "", pers);
                		           var del = buttonDel(id, "", pers);
                                   return edit + del;
                  	            }		
							},
                
            ]
		//,"order": [[ 0, "asc" ]]
        } );
}

layui.use(['layer','laydate'], function(){
    var layer = layui.layer;
	var laydate = layui.laydate;
	laydate.render({
		elem: '#approvalTime'
	});
});

function del(id){
	layer.confirm('确定要删除吗？', {
        btn : [ '确定', '取消' ]
    }, function() {
    	$.ajax({
            type : 'delete',
            url : '/projectFollowInfos/'+id,
            success : function(data) {
                example.ajax.reload();
                layer.msg("删除成功");
            }
        });
        
        layer.close(1);
    });
}

$("#searchBt").click(function(){
	example.ajax.reload();
});

init();
</script>
